import Vue from 'vue'
import Vuex from 'vuex'

const LOCAL_STORAGE_KEY = "searchHistory";

Vue.use(Vuex)

const store = new Vuex.Store({
	state:{//设置属性 用来存储数据
		user: JSON.parse(sessionStorage.getItem('user')),
		carousel_picture: '',
		},
	getters:{//对应方法 用来获取属性的状态
			getUser:state => state.user,
			getCarouselPicture:state => state.carousel_picture,
		},
	mutations:{//更改属性的状态
		setUser(state,data){
			sessionStorage.setItem('user',JSON.stringify(data))
			state.user = data
		},
		setCarouselPicture(state, data){
			state.carousel_picture = data
		},
		
		},
	actions:{//应用 mutation
		
		}
})

export default store
